import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;
import java.util.HexFormat;

public class Hmac {
    public static void main(String[] args) throws Exception {
        KeyGenerator keygen=KeyGenerator.getInstance("HmacMD5");
        SecretKey secretKey=keygen.generateKey();

        byte[] key=secretKey.getEncoded();
        System.out.println("HMAC MD5: "+ HexFormat.of().formatHex(key));
    }
}
